package com.jht.bletool2java.activity.blepage.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class BLEPageAdapter extends FragmentPagerAdapter {

    private static final String TAG = "MyViewPageAdapter";
    private String[] header_str;
    List<Fragment> data;

    public BLEPageAdapter(@NonNull FragmentManager fm, List<Fragment> fragments, String[] header_str) {
        super(fm);
        this.header_str = header_str;
        this.data = fragments;
    }



    public BLEPageAdapter(@NonNull FragmentManager fm, int behavior, List<Fragment> fragments, String[] header_str) {
        super(fm, behavior);
        this.header_str = header_str;
        this.data = fragments;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return header_str[position];
    }

}

